package at.fhj.ase.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * ASE10 - SS2011 
 * Project work Client Architecture and Design
 *  
 * @author Henning Diepold
 * @author Dieter Steiner
 */

public class JdbcConnection {

	protected final String dbDriverName = "com.mysql.jdbc.Driver";
	protected final String dbURI = "jdbc:mysql://localhost:3306/tinybank"; 
																				
	protected final String dbUserName = "test";
	protected final String dbUserPassword = "test";

	public Connection getConnection() throws ClassNotFoundException, SQLException {
		Class.forName(dbDriverName);
		Connection c = DriverManager.getConnection(dbURI, dbUserName,
				dbUserPassword);
		return c;
	}

	public void closeConnection(Connection c) throws SQLException {
		if (c != null) {
			c.close();
		}
	}

}
